package org.zxp.datastructure.array;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @program: algorithm
 * @description:测试ArrayList
 * @author: X-Pacific zhang
 * @create: 2019-07-03 22:16
 **/
public class ArrayListTest {



    public static void main(String[] args){
        ArrayList arr = new ArrayList();
        arr.add(1);
        arr.add(2);
        arr.add(3);
        arr.add(4);
        Iterator iterator = arr.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        Iterator iterator2 = arr.iterator();
        iterator2.forEachRemaining(x -> System.out.println(x));
    }


    @Test
    public void testArray(){
        ServerA serverA = new ServerA();
        ServerB serverB = new ServerB();
        String c = "aassccasdadsadasdasd";
        Object[] objs = new Object[3];
        objs[0] = serverA;
        objs[1] = serverB;
        objs[2] = c;
    }

    static class ServerA{
        private byte[] bytes = new byte[1024*1024*10];
    }

    static class ServerB{
    }
}
